<?php
/**
 * Creater : cuongnh
 * Date : 20/07/2011
 * Idea : Class Xu ly thong tin chuyen muc
 */
class Web_BookController extends  Zend_Controller_Action {	
	//Bien public luu quyen
	public $_publicPermission;
	public function init() {
        $tempDirApp = Zend_Registry::get('conDirApp');
		$this->_dirApp = $tempDirApp->toArray();
		$this->view->dirApp = $tempDirApp->toArray();
		$this->view->baseUrl = $baseUrl = $this->_request->getBaseUrl() . "/public/";
		Zend_Loader::loadClass('Zend_Json');
		$result = array(
                    array($baseUrl.'efy-js/jsWeb.js','js')
                    ,array($baseUrl.'efy-js/web/book.js','js')
                    ,array($baseUrl.'efy-js/web/tree.js','js')
                    ,array($baseUrl.'efy-js/jsTree/_lib/jquery.cookie.js','js')
                    ,array($baseUrl.'efy-js/jsTree/_lib/jquery.hotkeys.js','js')
                    ,array($baseUrl.'efy-js/jsTree/jquery.jstree.js','js')
                );
        if ($this->_request->isXmlHttpRequest()){
            Zend_Layout::startMvc(array(
                'layoutPath' => $app->layout,
                'layout' => 'partial'
            ));
            $this->view->arrJsCss = Zend_Json::encode($result);
        }else{
            //Cau hinh cho Zend_layout
            Zend_Layout::startMvc(array(
			    'layoutPath' => $this->_dirApp['layout'],
			    'layout' => 'backend'			    
			    ));	
            $response = $this->getResponse();
            $this->view->currentModulCode = "LIST";
            $this->view->currentModulCodeForLeft = "WEB_ARTICLE";
            $this->view->LoadAllFileJsCss = Efy_Library::registerFile($result);
            $objConfig = new Efy_Init_Config();
            $this->view->JSPublicConst = $objConfig->_setJavaScriptPublicVariable();	
            $this->view->hideDisplayMeneLeft = 1;
            //Hien thi file template
            $response->insert('header', $this->view->renderLayout('header.phtml','./application/views/scripts/')); 
			$response->insert('left', $this->view->renderLayout('left_backend.phtml','./application/views/scripts/')); 
	        $response->insert('footer', $this->view->renderLayout('footer.phtml','./application/views/scripts/'));

        }
        Zend_Loader::loadClass('web_modWebArticle');
        
        
    }


	/**
	 * Idea: Thuc hien phuong thuc Action hien thi danh sach doi tuong
	 */
	public function indexAction(){	
		//Lay URL 
		$sUrl = $_SERVER['REQUEST_URI'];
		$this->view->sUrl = $sUrl;		
		// Tieu de man hinh danh sach
		$this->view->bodyTitle = "DANH SÁCH TIN BÀI";
		
	}


	public function getChildNode($idNode,$arrTreeGetAll,$sType){
        $arrOutput = array();
        if($idNode==''){
            $rel ='home';
            $class = 'home';
        }else{
            $rel ='folder7';
            $class = 'unit';
        }
        foreach ($arrTreeGetAll as $key => $value) {
            if($value['UnitParent'] == $idNode){
                array_push($arrOutput, array('attr'=>array(
                                                'id'=>$value['UnitID']
                                                ,'rel'=>$rel
                                                ,'class'=>$class
                                            ),
                                            'data'=>$value['Name'],
                                            'state'=>'closed'
                ));
            }
        }
        $arrStaff = Clound_Session::getInstance()->get('StaffAll');
        foreach ($arrStaff as $key => $value) {
            if($value['UnitID'] == $idNode){
                array_push($arrOutput, array('attr'=>array(
                                                'id'=>$value['StaffID']
                                                ,'rel'=>'user'
                                                ,'class'=>'staff'
                                            ),
                                            'data'=>$value['Name'],
                                            // 'state'=>'closed'
                ));
            }
        }
        return $arrOutput;
    }
    public function loadtreeAction(){
        $Unit = new system_models_Unit();
        $Staff = new system_models_Staff();
        $session = new Clound_Session();
        $arrTree = '';
        $idNode = $this->_request->getParam('id','');
        $sType = $this->_request->getParam('sType','');


        $arrTreeGetAll = $session->get('UnitAll');
        if(!$arrTreeGetAll) {
            $arrTreeGetAll = $Unit->getAllTree();
            $session->set('UnitAll',$arrTreeGetAll);

        }
        if(!$session->get('StaffAll')) {
            $session->set('StaffAll',$Staff->getAllTree());
        }

        $arrTree = $this->getChildNode($idNode,$arrTreeGetAll,$sType);
        echo json_encode($arrTree);
        die;
    }
	/**
	 * Idea: Thuc hien phuong thuc Action them moi doi tuong 
	 */
	public function addAction(){
		$this->view->bodyTitle = 'THÊM MỚI TIN BÀI';
		
		$arrInput = $this->_request->getParams();
		$objDocFun = new Efy_Function_DocFunctions();
		$objArticle = new web_modWebArticle();
		$ojbXmlLib = new Efy_Publib_Xml();
		$ojbEfyLib = new Efy_Library();
		$objFilter = new Zend_Filter();
		$ojbEfyInitConfig = new Efy_Init_Config();	
		 //Lay thong tin history back
		$this->view->historyBack = $this->_request->getParam('hdn_history_back','');
		//Lay tham so cau hinh
		$efyLibUrlPath = $ojbEfyInitConfig->_setLibUrlPath();
		$url_path_calendar = $efyLibUrlPath . 'efy-calendar/';
		$this->view->urlCalendar = $url_path_calendar;
		
		//Lay editor
		Zend_Loader::loadClass('editor_fckeditor');
		//Tao doi tuong editor
		$objFCKeditor = new editor_fckeditor('C_CONTEN');
		//Duong dan vitual 
		$objFCKeditor->BasePath	= Efy_Init_Config::_setWebSitePath() . 'public/editor/';
		$objFCKeditor->Value = '';
		$sEditorString = $objFCKeditor->Create();
		$this->view->editor = $sEditorString;

		//Lay mang chuyen muc
		$arrMenu = $objArticle->WebArticlePermissionCheck($_SESSION['staff_id'],'EDIT_APPROVE','1');
		$this->view->arrMenu = $arrMenu;
		//Kiem tra xem co duoc them/ duyet tin hay ko?
		//$sShowApprove = 0;
		//$sShowEdit = 0;
		$sarrApprove = '';
		$arrMenuEdit = array();
		$i = 0;
		for($index = 0;$index < sizeof($arrMenu);$index++){
			if($arrMenu[$index]['C_EDIT']== '1'){
				//$sShowEdit = 1;
				$arrMenuEdit[$i]['PK_WEB_MENU'] = $arrMenu[$index]['PK_WEB_MENU'];
				$arrMenuEdit[$i]['C_NAME'] = $arrMenu[$index]['C_NAME'];
				$i = $i + 1;
			}
			if($arrMenu[$index]['C_APPROVE']== '1'){
				//$sShowApprove = 1;
				$sarrApprove = $sarrApprove.$arrMenu[$index]['PK_WEB_MENU'].',';
			}
		}	
		//var_dump($sarrApprove);
		//$this->view->sShowEdit = $sShowEdit;
		//$this->view->sShowApprove = $sShowApprove;
		$this->view->arrMenuEdit = $arrMenuEdit;
		$this->view->sarrApprove = $sarrApprove;		
		//Gan quyen sang VIEW
		$this->view->PermissionUser = $this->_publicPermission;
		
		//Lay cac tieu chi loc
		//Lay danh muc
		$sMenuID = $objFilter->filter($arrInput['C_MENU']);
		$this->view->sMenuID = $sMenuID;
		//Lay trang thai
		$iStatus = $objFilter->filter($arrInput['C_STATUS']);
		$this->view->iStatus = $iStatus;
		//Tim kiem
		$sFullTextSearch = $this->_request->getParam('FullTextSearch','');
		$this->view->FullTextSearch = $sFullTextSearch;
		// Lay trang so.../ quy dinh so tin bai tren mot trang
		$iCurrentPage = $this->_request->getParam('hdn_current_page','');		
		$iNumRowOnPage = $objFilter->filter($arrInput['hdn_record_number_page']);	
		//Truyen sang view
		$this->view->iCurrentPage = $iCurrentPage;
		$this->view->iNumRowOnPage = $iNumRowOnPage;
		//echo '$iNumRowOnPage'.$iNumRowOnPage;
		// Dua vao session											
		$arrParaSet = array("hdn_menuid"=>$sMenuID,"hdn_status"=>$iStatus,"hdn_fulltextseach"=>$sFullTextSearch,"hdn_current_page"=>$iCurrentPage,"hdn_record_number_page"=>$iNumRowOnPage);
		$_SESSION['seArrParameter'] = $arrParaSet;
		$this->_request->setParams($arrParaSet);

		$this->view->AttachImageFile = $objDocFun->DocSentAttachOneFile(array(),0,1,true,40,'article/image-upload/');
		
		$this->view->AttachFile = $objDocFun->DocSentAttachFile(array(),0,10,true,80,'article/file-upload/');
		
		//Tuy chon ung voi cac truong hop update du lieu	
		$sOption = $this->_request->getParam('hdh_option','');
		$this->view->option = $sOption;
		//echo $sOption; exit;
		//echo 'ok'.$objFilter->filter($arrInput['C_NAME']); exit;
		if ($objFilter->filter($arrInput['C_TITLE']) != ""){
			$sStaffName = $objDocFun->getNamePositionStaffByIdList($_SESSION['staff_id']);
			$iStatus = $objFilter->filter($arrInput['hdn_approved_status']);
			$iHightlight = $objFilter->filter($arrInput['hdn_hightlights_status']);	
			//echo $iStatus;exit;		
			if($iStatus == '1'){
				$sApproved_staff = $_SESSION['staff_id'];
			}else{
				$sApproved_staff = '';
			}
			//echo $sStaffName;
			//Thuc hien upload anh len o cung
			$arrImageNameUpload = $ojbEfyLib->_uploadFileList(1,$this->_request->getBaseUrl() . "/public/attach-file/article/image-upload/",'FileImageName','!#~$|*');
			//Thuc hien upload file dinh kem len o cung
			$arrFileNameUpload = $ojbEfyLib->_uploadFileList(10,$this->_request->getBaseUrl() . "/public/attach-file/article/file-upload/",'FileName','!#~$|*');
			//var_dump($arrFileNameUpload); exit;	
			$sconten = str_replace(chr(92),'',htmlspecialchars($this->_request->getParam('C_CONTEN','')));
			$sconten = str_replace(chr(39),'',$sconten);
			$arrParameter = array(	
								'PK_WEB_ARTICLE'				=>'',										
								'FK_WEB_MENU'					=>$objFilter->filter($arrInput['PK_WEB_MENU']),
								'C_TITLE'						=>$ojbEfyLib->_replaceBadChar($objFilter->filter($arrInput['C_TITLE'])),
								'C_SHORT_CONTENT'				=>$ojbEfyLib->_replaceBadChar($objFilter->filter($arrInput['C_SUBJECT'])),
								'C_DETAIL_CONTENT'				=>$sconten,
								'C_IMAGE_TITLE'					=>$ojbEfyLib->_replaceBadChar($objFilter->filter($arrInput['C_IMAGE_TITLE'])),
								'FK_CREATE_STAFF'				=>$_SESSION['staff_id'],
								'FK_CREATE_NAME'				=>$sStaffName,
								'FK_APPROVE_STAFF'				=>$sApproved_staff,
								'C_HIGHTLIGHT'					=>$iHightlight,
								'C_STATUS'						=>$iStatus,
								'IMAGE_NAME'					=>$arrImageNameUpload,
								'ATTACH_FILE_NAME_LIST'			=>$arrFileNameUpload
						);
			//var_dump($arrParameter); exit;				
			$Result = "";	
			$Result = $objArticle->WebArticleUpdate($arrParameter);			
			if($sOption =='GHI_THEMMOI'){
				$this->_redirect('/web/article/add/');	
			}else{
				$this->_redirect('/web/article/index/');
			}		
		}
	}	
	/**
	 * Creater: cuongnh
	 * Date: 21/07/2011
	 * Idea: Thuc hien Action hieu chinh thong tin doi tuong
	 */
	public function editAction(){
		$this->view->bodyTitle = 'THÔNG TIN CHI TIẾT TIN BÀI';
		
		$arrInput = $this->_request->getParams();
		$objDocFun = new Efy_Function_DocFunctions();
		$objArticle = new web_modWebArticle();
		$ojbXmlLib = new Efy_Publib_Xml();
		$ojbEfyLib = new Efy_Library();
		$objFilter = new Zend_Filter();
		$ojbEfyInitConfig = new Efy_Init_Config();	
		 //Lay thong tin history back
		$this->view->historyBack = $this->_request->getParam('hdn_history_back','');
		$sWebArticleId = $this->_request->getParam('hdn_object_id','');		
		//Lay thong tin chi tiet
		$this->view->sWebArticleId = $sWebArticleId;
		$arrArticle = $objArticle->WebArticleGetSingle($sWebArticleId);
		$this->view->arrArticle = $arrArticle;
		//Lay editor
		Zend_Loader::loadClass('editor_fckeditor');
		//Tao doi tuong editor
		$objFCKeditor = new editor_fckeditor('C_CONTEN');
		//Duong dan vitual 
		$objFCKeditor->BasePath	= Efy_Init_Config::_setWebSitePath() . 'public/editor/';
		$objFCKeditor->Value = $arrArticle[0][C_DETAIL_CONTENT];
		$sEditorString = $objFCKeditor->Create();
		$this->view->editor = $sEditorString;
		
		//Lay tham so cau hinh
		$efyLibUrlPath = $ojbEfyInitConfig->_setLibUrlPath();
		$url_path_calendar = $efyLibUrlPath . 'efy-calendar/';
		$this->view->urlCalendar = $url_path_calendar;
		//Lay mang chuyen muc
		$arrMenu = $objArticle->WebArticlePermissionCheck($_SESSION['staff_id'],'EDIT_APPROVE','1');
		$this->view->arrMenu = $arrMenu;
		//Kiem tra xem co duoc them/ duyet tin hay ko?
		$sShowApprove = 0;
		//$sShowEdit = 0;
		$sarrApprove = '';
		$arrMenuEdit = array();
		$i = 0;
		for($index = 0;$index < sizeof($arrMenu);$index++){
			if($arrMenu[$index]['C_EDIT']== '1'){
				//$sShowEdit = 1;
				$arrMenuEdit[$i]['PK_WEB_MENU'] = $arrMenu[$index]['PK_WEB_MENU'];
				$arrMenuEdit[$i]['C_NAME'] = $arrMenu[$index]['C_NAME'];
				$i = $i + 1;
			}
			if($arrMenu[$index]['C_APPROVE']== '1'){
				if( $arrMenu[$index]['PK_WEB_MENU']==$arrArticle[0][FK_WEB_MENU]){
					$sShowApprove = 1;	
				}
				$sarrApprove = $sarrApprove.$arrMenu[$index]['PK_WEB_MENU'].',';
			}
		}	
		//$this->view->sShowEdit = $sShowEdit;
		//echo $sShowApprove;
		$this->view->sShowApprove = $sShowApprove;
		$this->view->arrMenuEdit = $arrMenuEdit;
		$this->view->sarrApprove = $sarrApprove;	
		
		//Gan quyen sang VIEW
		$this->view->PermissionUser = $this->_publicPermission;
		
		$idisabled = 0;
		if($arrArticle[0]['FK_CREATE_STAFF'] == $_SESSION['staff_id']){
			$idisabled = 1;  
		}
		$this->view->idisabled = $idisabled;
		//Lay cac tieu chi loc
		//Lay danh muc
		$sMenuID = $objFilter->filter($arrInput['C_MENU']);
		$this->view->sMenuID = $sMenuID;
		//Lay trang thai
		$iStatus = $objFilter->filter($arrInput['C_STATUS']);
		$this->view->iStatus = $iStatus;
		//Tim kiem
		$sFullTextSearch = $this->_request->getParam('FullTextSearch','');
		$this->view->FullTextSearch = $sFullTextSearch;
		// Lay trang so.../ quy dinh so tin bai tren mot trang
		$iCurrentPage = $this->_request->getParam('hdn_current_page','');		
		$iNumRowOnPage = $objFilter->filter($arrInput['hdn_record_number_page']);	
		//Truyen sang view
		$this->view->iCurrentPage = $iCurrentPage;
		$this->view->iNumRowOnPage = $iNumRowOnPage;
		//echo '$iNumRowOnPage'.$iNumRowOnPage;
		// Dua vao session											
		$arrParaSet = array("hdn_menuid"=>$sMenuID,"hdn_status"=>$iStatus,"hdn_fulltextseach"=>$sFullTextSearch,"hdn_current_page"=>$iCurrentPage,"hdn_record_number_page"=>$iNumRowOnPage);
		$_SESSION['seArrParameter'] = $arrParaSet;
		$this->_request->setParams($arrParaSet);
		//var_dump($_SESSION['seArrParameter']);
		//Lay anh da dinh kem tu truoc
		$arrImage = $objArticle->DOC_GetAllDocumentFileAttach($sWebArticleId,'WEB_IMAGE','T_WEB_ARTICLE');	
		$this->view->AttachImageFile = $objDocFun->DocSentAttachOneFile($arrImage,sizeof($arrImage),1,true,40,'article/image-upload/');	
		//Lay file dinh kem tu truoc
		$arFileAttach = $objArticle->DOC_GetAllDocumentFileAttach($sWebArticleId,'WEB_FILE','T_WEB_ARTICLE');	
		//var_dump($arFileAttach);
		$this->view->AttachFile = $objDocFun->DocSentAttachFile($arFileAttach,sizeof($arFileAttach),10,true,80,'article/file-upload/');
		//Tuy chon ung voi cac truong hop update du lieu	
		$sOption = $this->_request->getParam('hdh_option','');
		$this->view->option = $sOption;
		//echo 'ok'.$objFilter->filter($arrInput['C_NAME']); exit;
		if ($objFilter->filter($arrInput['C_TITLE']) != ""){
			$sStaffName = $objDocFun->getNamePositionStaffByIdList($_SESSION['staff_id']);
			$iStatus = $objFilter->filter($arrInput['hdn_approved_status']);
			if($iStatus == '1'){
				$sApproved_staff = $_SESSION['staff_id'];
			}else{
				$sApproved_staff = '';
			}
			$iHightlight = $objFilter->filter($arrInput['hdn_hightlights_status']);	
			//Thuc hien upload anh len o cung
			$arrImageNameUpload = $ojbEfyLib->_uploadFileList(1,$this->_request->getBaseUrl() . "/public/attach-file/article/image-upload/",'FileImageName','!#~$|*');
			//Thuc hien upload file dinh kem len o cung
			$arrFileNameUpload = $ojbEfyLib->_uploadFileList(10,$this->_request->getBaseUrl() . "/public/attach-file/article/file-upload/",'FileName','!#~$|*');
			//var_dump($arrFileNameUpload); exit;	
			$sconten = str_replace(chr(92),'',htmlspecialchars($this->_request->getParam('C_CONTEN','')));
			$sconten = str_replace(chr(39),'',$sconten);	
			$arrParameter = array(	
								'PK_WEB_ARTICLE'				=>$sWebArticleId,										
								'FK_WEB_MENU'					=>$objFilter->filter($arrInput['PK_WEB_MENU']),
								'C_TITLE'						=>$ojbEfyLib->_replaceBadChar($objFilter->filter($arrInput['C_TITLE'])),
								'C_SHORT_CONTENT'				=>$ojbEfyLib->_replaceBadChar($objFilter->filter($arrInput['C_SUBJECT'])),
								'C_DETAIL_CONTENT'				=>$sconten,
								'C_IMAGE_TITLE'					=>$ojbEfyLib->_replaceBadChar($objFilter->filter($arrInput['C_IMAGE_TITLE'])),
								'FK_CREATE_STAFF'				=>$_SESSION['staff_id'],
								'FK_CREATE_NAME'				=>$sStaffName,
								'FK_APPROVE_STAFF'				=>$sApproved_staff,
								'C_HIGHTLIGHT'					=>$iHightlight,
								'C_STATUS'						=>$iStatus,
								'IMAGE_NAME'					=>$arrImageNameUpload,
								'ATTACH_FILE_NAME_LIST'			=>$arrFileNameUpload
						);
			//var_dump($arrParameter); exit;				
			$Result = "";			
			$Result = $objArticle->WebArticleUpdate($arrParameter);				
			if($sOption =='GHI_THEMMOI'){
				$this->_redirect('/web/article/add/');	
			}else{
				$this->_redirect('/web/article/index/');
			}		
		}
	}
	
	/**
	 * 
	 * Enter description here ...
	 */
	public function deleteAction(){	
		// Tao doi tuong cho lop xu ly du lieu lien quan modul	
		$objArticle = new web_modWebArticle();
		$ojbEfyLib = new Efy_Library();
		$objFilter = new Zend_Filter();
		$arrInput = $this->_request->getParams();
		// Lay vi tri hien thi
		$iPosition = $this->_request->getParam('hdn_position',0);
		$this->view->iPosition = $iPosition;
		
		//Lay cac tieu chi loc
		//Lay danh muc
		$sMenuID = $objFilter->filter($arrInput['C_MENU']);
		$this->view->sMenuID = $sMenuID;
		//Lay trang thai
		$iStatus = $objFilter->filter($arrInput['C_STATUS']);
		$this->view->iStatus = $iStatus;
		//Tim kiem
		$sFullTextSearch = $this->_request->getParam('FullTextSearch','');
		$this->view->FullTextSearch = $sFullTextSearch;
		// Lay trang so.../ quy dinh so tin bai tren mot trang
		$iCurrentPage = $this->_request->getParam('hdn_current_page','');		
		$iNumRowOnPage = $objFilter->filter($arrInput['hdn_record_number_page']);	
		//echo '$iNumRowOnPage'.$iNumRowOnPage;
		// Dua vao session											
		$arrParaSet = array("hdn_menuid"=>$sMenuID,"hdn_status"=>$iStatus,"hdn_fulltextseach"=>$sFullTextSearch,"hdn_current_page"=>$iCurrentPage,"hdn_record_number_page"=>$iNumRowOnPage);
		$_SESSION['seArrParameter'] = $arrParaSet;
		$this->_request->setParams($arrParaSet);
		
		// Thuc hien lay du lieu tu form 		
		if($this->_request->isPost()){	
			// Lay toan bo tham so truyen tu form			
			$arrInput = $this->_request->getParams();							
			//Lay Id doi tuong VB can xoa
			$sArticleIdList = $this->_request->getParam('hdn_object_id_list',"");	
			//echo $sArticleIdList; exit;
			if ($sArticleIdList != ""){
				$sRetError = $objArticle->WebArticleDelete($sArticleIdList);
				// Neu co loi			
				if($sRetError != null || $sRetError != '' ){											
					echo "<script type='text/javascript'>";
					echo "alert('$sRetError');\n";				
					echo "</script>";
				}else {		
					//Tro ve trang index												
					$this->_redirect('/web/article/index/');				
				}
			}
		}	
	}
	/**
	 * 
	 * Enter description here ...
	 */
	public function moveAction(){	
		// Tao doi tuong cho lop xu ly du lieu lien quan modul	
		$objArticle = new web_modWebArticle();
		$ojbEfyLib = new Efy_Library();
		$objFilter = new Zend_Filter();
		$arrInput = $this->_request->getParams();
		//Lay cac tieu chi loc
		//Lay danh muc
		$sMenuID = $objFilter->filter($arrInput['C_MENU']);
		$this->view->sMenuID = $sMenuID;
		//Lay trang thai
		$iStatus = $objFilter->filter($arrInput['C_STATUS']);
		$this->view->iStatus = $iStatus;
		//Tim kiem
		$sFullTextSearch = $this->_request->getParam('FullTextSearch','');
		$this->view->FullTextSearch = $sFullTextSearch;
		// Lay trang so.../ quy dinh so tin bai tren mot trang
		$iCurrentPage = $this->_request->getParam('hdn_current_page','');		
		$iNumRowOnPage = $objFilter->filter($arrInput['hdn_record_number_page']);	
		//echo '$iNumRowOnPage'.$iNumRowOnPage;
		// Dua vao session											
		$arrParaSet = array("hdn_menuid"=>$sMenuID,"hdn_status"=>$iStatus,"hdn_fulltextseach"=>$sFullTextSearch,"hdn_current_page"=>$iCurrentPage,"hdn_record_number_page"=>$iNumRowOnPage);
		$_SESSION['seArrParameter'] = $arrParaSet;
		$this->_request->setParams($arrParaSet);
		//thuc hien di chuyen tin bai
		$cMove = $objFilter->filter($arrInput['hdn_move']);
		if($cMove == 'MOVE'){
			$iMoveOrder = $objFilter->filter($arrInput['hdn_move_order']);
			$sArticleID = $objFilter->filter($arrInput['hdn_object_id']);
			$sRetError = $objArticle->WebArticleMove($sArticleID,$iMoveOrder);
			$this->_redirect('/web/article/index/');	
		}

	}
	/**
	 * 
	 * Enter description here ...
	 */
	public function approvedAction(){	
		// Tao doi tuong cho lop xu ly du lieu lien quan modul	
		$objArticle = new web_modWebArticle();
		$ojbEfyLib = new Efy_Library();
		$objFilter = new Zend_Filter();
		$arrInput = $this->_request->getParams();
		//Lay cac tieu chi loc
		//Lay danh muc
		$sMenuID = $objFilter->filter($arrInput['C_MENU']);
		$this->view->sMenuID = $sMenuID;
		//Lay trang thai
		$iStatus = $objFilter->filter($arrInput['C_STATUS']);
		$this->view->iStatus = $iStatus;
		//Tim kiem
		$sFullTextSearch = $this->_request->getParam('FullTextSearch','');
		$this->view->FullTextSearch = $sFullTextSearch;
		// Lay trang so.../ quy dinh so tin bai tren mot trang
		$iCurrentPage = $this->_request->getParam('hdn_current_page','');		
		$iNumRowOnPage = $objFilter->filter($arrInput['hdn_record_number_page']);	
		//echo '$iNumRowOnPage'.$iNumRowOnPage;
		// Dua vao session											
		$arrParaSet = array("hdn_menuid"=>$sMenuID,"hdn_status"=>$iStatus,"hdn_fulltextseach"=>$sFullTextSearch,"hdn_current_page"=>$iCurrentPage,"hdn_record_number_page"=>$iNumRowOnPage);
		$_SESSION['seArrParameter'] = $arrParaSet;
		$this->_request->setParams($arrParaSet);
		// Thuc hien lay du lieu tu form 		
		if($this->_request->isPost()){	
			$sArticleIdList = $this->_request->getParam('hdn_object_id_list',"");	
			//echo $sArticleIdList;exit;
			if ($sArticleIdList != ""){
				$sRetError = $objArticle->WebArticleApprove($sArticleIdList,$_SESSION['staff_id']);							
				$this->_redirect('/web/article/index/');				
			}
		}	
	}
}
?>